package com.vincent.sciinfo.mapper;

import com.vincent.sciinfo.pojo.LoginCount;
import com.vincent.sciinfo.pojo.LoginCountExample;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LoginCountMapper {
    long countByExample(LoginCountExample example);

    int deleteByExample(LoginCountExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(LoginCount record);

    int insertSelective(LoginCount record);

    List<LoginCount> selectByExample(LoginCountExample example);

    LoginCount selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") LoginCount record, @Param("example") LoginCountExample example);

    int updateByExample(@Param("record") LoginCount record, @Param("example") LoginCountExample example);

    int updateByPrimaryKeySelective(LoginCount record);

    int updateByPrimaryKey(LoginCount record);

    @Select("SELECT* FROM logincount ORDER BY loginCount DESC LIMIT 5")
    List<LoginCount> selectAll();

    @Select("select* from logincount where userId = #{loginCount.userId}")
    LoginCount selectOne(@Param("loginCount") LoginCount loginCount);

    @Update("update logincount set loginCount = #{count} where userId = #{loginCount.userId} ")
    int updateOne(@Param("loginCount") LoginCount loginCount, @Param("count") Integer count);

    @Insert("insert into logincount (userId, loginCount) values ( #{loginCount.userId}, #{count})")
    int insertOne(@Param("loginCount") LoginCount loginCount, @Param("count") Integer count);

}